import { Module } from '@nestjs/common';
import { RedisModule } from '@liaoliaots/nestjs-redis';
import { ConfigService } from '@nestjs/config';
import { getRedisConfig } from './redis.config';
import { RedisService } from './redis.service';
import { TypedConfigService } from 'src/config/typed-config.service';

@Module({
  imports: [
    RedisModule.forRootAsync({
      useFactory: (configService: TypedConfigService) => getRedisConfig(configService),
      inject: [ConfigService],
    }),
  ],
  providers: [RedisService],
  exports: [RedisModule, RedisService],
})
export class RedisClientModule {}
